package com.longyb.mylive.server.jt1078;

import io.netty.buffer.ByteBuf;
import lombok.Data;
import org.checkerframework.checker.units.qual.A;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO
 *
 * @author chengxuwei
 * @date 2024-04-25
 * @since 1.0.0
 */
@Data
public class JT1078Msg {
  public static Map<Integer,String> mediaType=new HashMap<>();

  static {

    mediaType.put(6,"G.711A");
    mediaType.put(7,"G.711U");
    mediaType.put(8,"G.726_23k");
    mediaType.put(26,"ADPCMA ");
    mediaType.put(98,"H264");
    mediaType.put(99,"H265");

  }
  public static Map<Integer,String> frameType=new HashMap<>();

  static {
    frameType.put(0,"I帧");
    frameType.put(1,"P帧");
    frameType.put(2,"B帧");
    frameType.put(3,"音频");
    frameType.put(4,"透传");
  }
  public static Map<Integer,String> packType=new HashMap<>();

  static {
    packType.put(0,"原子包");
    packType.put(1,"第一个包");
    packType.put(2,"最后一个包");
    packType.put(3,"中间包");
  }
  /**
   * 4byte 固定头
   */
  private byte[] HEAD;
  //--------------
  /**
   * 1byte
   */
  private int exFlag;
  /**
   * 2bit 拆分exFlag
   */
  private int exV;
  /**
   * 1bit 拆分exFlag
   */
  private int exP;
  /**
   * 1bit 拆分exFlag
   */
  private int exX;
  /**
   * 4bit 拆分exFlag
   */
  private int exCC;
  //--------------
  /**
   * 1byte
   */
  private int fmtFlag;
  /**
   * 1bit 拆分exFlag
   */
  private int fmtM;
  /**
   * 7bit 拆分exFlag
   */
  private int fmtPT;
  //--------------
  /**
   * 2byte
   */
  private int seq;
  /**
   * 6byte BCD
   */
  private String sim;
  /**
   * 1byte
   */
  private int channel;
  /**
   * 1byte
   */
  private int dataFlag;
  /**
   * 4bit 拆分dataFlag
   */
  private int dataType;
  /**
   * 4bit 拆分dataFlag
   */
  private int dataSplit;
  //--------------
  /**
   * 8byte
   */
  private long timestamp;
  /**
   * 2byte
   */
  private int lastIFrameMs;
  /**
   * 2byte
   */
  private int lastFrameMs;
  /**
   * 2byte
   */
  private int rtpLen;
  /**
   * N byte =rtpLen
   */
  private ByteBuf rtpData;

  /**
   * 原始数据
   */
  private byte[] origin;
  /**
   * RTP解析
   */
  private RTP rtp;
}
